<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Untilities
 *
 * @author khavu
 */
class Australian_Utilities {
    
    const not_permission_add            = "You not have ADD permission on this page ! ";
    const not_permission_edit           = "You not have EDIT permission on this page ! ";
    const not_permission_delete         = "You not have DELETE permission on this page ! ";
    const email_admin                   = "admin@sitetech.vn";

//put your code here
    public function getPermission($groupid, $controller) {
        $db          = Zend_Registry::get('connectDb');
        $select      = $db->select()
                          ->from('permission AS p', array('view_p', 'add_p', 'edit_p','delete_p'))
                          ->joinLeft('page AS pa', 'pa.id = p.pageid','')
                          ->where("p.groupid = '$groupid' AND pa.controller = '$controller' ");
        $rs          = $db->fetchAll($select);
        return $rs[0];          
    }
    public function countNewMessage() {
        $db          = Zend_Registry::get('connectDb');
        $select      = $db->select()
                          ->from('contact AS c', array('COUNT(c.conid) AS number'))
                          ->where("c.status = '0' ");
        $rs          = $db->fetchOne($select);
        $count       = intval($rs);
        return       $count;    
    }

}
